package com.dnjn.happiness.survey.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dnjn.happiness.common.core.annotation.Excel;
import com.dnjn.happiness.common.core.web.domain.BaseEntity;
import com.dnjn.happiness.system.api.domain.SysUser;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 创建问卷模板对象 svy_survey_template
 *
 * @author happiness
 * @date 2023-11-20
 */
@Schema(name = "SurveyTemplate", description = "创建问卷模板")
@Accessors(chain = true)
@Getter
@Setter
@TableName("svy_survey_template")
@ToString
public class SurveyTemplate extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * PK
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(value = "survey_id", type = IdType.ASSIGN_ID)
    private Long surveyId;


    


    /**
     * 问卷类型 COMMON-普通, COMMUNICATE-沟通
     */
    @Schema(description = "问卷类型BUILTIN-内置问卷,CUSTOM-自定义问卷")
    @Excel(name = "问卷类型BUILTIN-内置问卷,CUSTOM-自定义问卷")
    private String surveyType;

    /**
     * 发起人id
     */
    @Schema(description = "发起人id")
    @Excel(name = "发起人id")
    private Long initiatorId;

    /**
     * 问卷标题
     */
    @Schema(description = "问卷标题")
    @Excel(name = "问卷标题")
    private String surveyTitle;

    /**
     * 问卷描述
     */
    @Schema(description = "问卷描述")
    @Excel(name = "问卷描述")
    private String surveyDescription;

    /**
     * $column.columnComment
     */
    @Schema(description = "${comment}")
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private Long ordinal;

    /**
     * READY-创建中 PROCESSING-已下发 FINISHED-已结束（到结束时间后）
     */
    @Schema(description = " READY-创建中 PROCESSING-已下发 FINISHED-已结束,选择创建问卷需要前端将 surveyStatus设置为READY,小程序选择下发问卷需设置为PROCESSING")
    @Excel(name = " READY-创建中 PROCESSING-已下发 FINISHED-已结束", readConverterExp = "到=结束时间后")
    private String surveyStatus;

    /**
     * 开始时间
     */
    @Schema(description = "开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime dateStart;

    /**
     * 结束时间
     */
    @Schema(description = "结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime dateEnd;

    /**
     * $column.columnComment
     */
    @Schema(description = "厂区id", requiredMode = Schema.RequiredMode.REQUIRED)
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private Long siteId;

    /**
     * 题库模块id
     */
    @Schema(description = "题库模块id", requiredMode = Schema.RequiredMode.REQUIRED)
    @Excel(name = "题库模块id")
    private Long tikuTagsId;

    /**
     * 是否删除|0-否 1-是|valid
     */
    @Schema(description = "是否删除|0-否 1-是|valid")
    @Excel(name = "是否删除|0-否 1-是|valid")
    private String deleted;
    @Schema(description = "下发状态")
    private String issuedStatus;

    private Integer minScore;

    private Integer maxScore;
    //问卷发起人姓名
    @TableField(exist = false)
    private String initiatorName;

    @TableField(exist = false)
    @Schema(description = "指定问卷参加人", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private List<Long> userIds;

    @TableField(exist = false)
    @Schema(description = "参加人对象列表", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private List<SysUser> userList;

    @TableField(exist = false)
    @Schema(description = "查看我需要参与的问卷", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Long watchId;
    @TableField(exist = false)
    @Schema(description = "题库类型名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private String label;

    @TableField(exist = false)
    @Schema(description = "选择题目的id")
    private List<Long> timuIds;

    @TableField(exist = false)
    @Schema(description = "题库题目集合")
    private List<Tiku> tikuList;

    @TableField(exist = false)
    @Schema(description = "这条问卷记录的状态,已参与,未参与")
    private String recordStatus;
    @TableField(exist = false)
    private Long communicateId;
    @Schema(description = "个人详情表-查看具体点进去的人")
    @TableField(exist = false)
    private String userId;

    @TableField(exist = false)
    private String answerAppraise;
    @Schema(description = "题库id")
    @TableField(exist = false)
    private Long tikuId;


    @Schema(description = "问卷问题类型：CHARACTER 人格;PERSONALITY 性格;COMMON 普通")
    private String questionType;

    @Schema(description = "问卷模板所选题库id集合")
    private String tikuIds;

    @Schema(description = "问卷模板使用次数")
    @TableField(exist = false)
    private Integer count;

    /**
     * 问卷所属区间集合
     */
    @TableField(exist = false)
    private List<SurveyIntervalScore> intervalScoreList;


}
